/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package network.ActiveElements;

import java.util.Collection;
import java.util.Iterator;
import network.Base.IPAddress;
import network.Base.PathElement;
import network.Base.Exceptions.IPParseException;
/**
 *
 * @author Lega
 */
public class Firewall extends ActiveElement{
    public Firewall (Collection<PathElement> connections_,
            double delay_, double cost_, int id_, Collection<IPAddress> ip_) {
        super(connections_, delay_, cost_, id_, ip_);
        info = "Firewall";
    }
    public Firewall (Collection<PathElement> connections_,
            double delay_, double cost_, int id_, Collection<IPAddress> ip_,
            Collection<String> accepted_ips_) {
        super(connections_, delay_, cost_, id_, ip_);
        Iterator<String> ips_iter = accepted_ips_.iterator();
        if (accepted_ips_ == null)
            throw new NullPointerException("accepted ips stack is null");
         while (ips_iter.hasNext()) {
            try{
                accepted_ips.add(new IPAddress(ip_.toString()));
            } catch (IPParseException e) {
                System.out.println(e.toString());
                return;
            }
        }
    }

    private Collection<IPAddress> accepted_ips;

}
